//Fluorine
#include <bits/stdc++.h>
#define N 800010
using namespace std;
int n;
struct node{
	int from,to,wei;
}b[N];
namespace Buf{
	int got[2020][2020],st,vis[2020],wg[2020][2020];
	vector<int> ed[2020];
	void dfs(int now,int w){
		vis[now]=1;
//		printf("It is %d,w=%d;\n",now,w);
		int LIMI=ed[now].size(),vt;
		for(int i=0;i<LIMI;i++){
			vt=ed[now][i];
			if(!vis[vt]){
//				printf("%d %d\n",vt,w);
				got[st][vt]=min(w,wg[now][vt]);
				dfs(vt,got[st][vt]);
			}
		}
		return;
	}
	void solve(){
		for(int cut=1;cut<n;cut++){
			for(int i=0;i<=n+1;i++)ed[i].clear();
			int ntt=b[cut].wei;
			b[cut].wei=0;
			//for(int i=1;i<=n;i++)for(int j=1;j<=n;j++)wg[i][j]=100;
			for(int i=1;i<n;i++){
				ed[b[i].from].push_back(b[i].to);
				ed[b[i].to].push_back(b[i].from);
				wg[b[i].from][b[i].to]=wg[b[i].to][b[i].from]=b[i].wei;
			}
			for(int i=1;i<=n;i++){
//				printf("#i:%d\n",i);
				st=i;dfs(i,100);
//				puts("\n------");
//				for(int qp=1;qp<=n;qp++){
//					for(int pq=1;pq<=n;pq++) cout<<got[qp][pq]<<' ';
//					cout<<endl;
//				}
//				puts("");
//				puts("");
//				puts("");
				memset(vis,0,sizeof(vis));
			}
			int ot=0;
			for(int i=1;i<=n;i++){for(int j=i+1;j<=n;j++)ot+=got[i][j];}
//			printf("==========================================================%d\n",ot);
			printf("%d\n",ot);
			b[cut].wei=ntt;
		}
		return;
	}
}
signed main(){
	freopen("tatooine.in","r",stdin);
	freopen("tatooine.out","w",stdout);
	scanf("%d",&n);
	for(int i=1;i<n;i++) scanf("%d%d%d",&b[i].from,&b[i].to,&b[i].wei);
	if(n<=2000) Buf::solve();
	return 0;
}
